<template>
    <div>
        <div class="searchInput">
            <div class="kuang">
                <div>
                    充电订单号： <el-input v-model="searchOrderNumber" placeholder="请输入订单编号"></el-input>&emsp;&emsp13;
                </div>
                <div>
                    手机号： <el-input v-model="searchPhoneNumber" placeholder="请输入手机号"></el-input>&emsp;&emsp13;
                </div>
            <div>
                状态：   <el-select style="width: 116px;" v-model="searchState" placeholder="请选择">
                            <el-option
                            v-for="item in stateOptions"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                        </el-option>
                    </el-select>
            </div>
            <div>
                    <span class="demonstration">&emsp;&emsp;&emsp;时间： </span>
                    <el-date-picker
                    v-model="searchDate"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期">
                    </el-date-picker>
                </div>
        </div>
        <div class="btns">
            <el-button class="chaxun">查询</el-button>
            <el-button class="reset">重置</el-button>
        </div>
        </div>
        <!-- 数据 -->
        <el-table
            :header-cell-style="{background:'#e8efff',color:'#000000'}"
            :data="lockTableData"
            :loading="loading"
            style="width: 100%">
            <el-table-column
            type="selection"
            width="55">
            </el-table-column>
            <el-table-column prop="order" label="序号" width="60">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.order }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="charge_number" label="充值订单号">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.charge_number }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="user_id" label="用户ID">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.user_id }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="phone" label="手机号">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.phone }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="charging_money" label="充值金额" width="150">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.charging_money }}元
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="account_money" label="账户金额">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.account_money }}元
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="state" label="状态">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                      <span v-if="scope.row.state == 0">充值成功</span>
                      <span v-if="scope.row.state == 1">充值失败</span>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="charge_time" label="充值时间">
                <template v-slot="scope">
                    <div style="color:#949BBE;">
                        {{ scope.row.charge_time }}
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="address" label="操作">
                <template v-slot="scope">
                    <div class="scope" style="color:#949BBE;">
                        <span class="detailBtn" @click="goDetail(scope.row.id)">详情</span>
                    </div>
                </template>
            </el-table-column>
        </el-table>
        <Pagination />
        <!-- 添加/详情/编辑 -->
        <el-dialog center :close-on-click-modal="false" width="636px" :visible.sync="newDetailVisible">
            <template slot="title">
                <div class="dialog_title">
                    充值详情
                </div>
            </template>
            <el-form label-position="right" label-width="120px" :model="chargeDetail">
                <el-form-item prop="user_id" label="充值订单号:">
                    <el-input disabled v-model="chargeDetail.order_number" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="用户ID:">
                    <el-input disabled v-model="chargeDetail.user_id" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="手机号:">
                    <el-input disabled v-model="chargeDetail.phone" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="充值金额:">
                    <el-input disabled v-model="chargeDetail.charge_money" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="账户金额:">
                    <el-input disabled v-model="chargeDetail.account_money" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="状态:">
                    <el-input disabled v-model="chargeDetail.state" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="充值时间:">
                    <el-input disabled v-model="chargeDetail.charge_time" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="user_id" label="到账时间:">
                    <el-input disabled v-model="chargeDetail.payment" autocomplete="off"></el-input>
                </el-form-item>
                <el-form-item prop="cause" label="原因:">
                    <el-input disabled v-model="chargeDetail.cause" autocomplete="off"></el-input>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
import Pagination from '@/components/Pagination.vue'
    export default {
        components:{
            Pagination
        },
        data() {
            return {
                loading:true,
                disabled:false,
                searchOrderNumber:'',
                searchPhoneNumber:'',
                searchDate:'',
                searchState:null,
                    stateOptions: [
                        {
                        value: null,
                        label: '请选择'
                        }, 
                        {
                        value: 0,
                        label: '充值成功'
                        }, 
                        {
                        value: 1,
                        label: '充值失败'
                        }, 
                    ],
                    lockTableData: [
                    {
                        order: '1',
                        charge_number: '20230202123',
                        user_id: '姜子鱼',
                        phone:'159****3765',
                        charging_money:45,
                        account_money:50,
                        state:0,
                        charge_time:'2023.03.03',
                        id:1
                    },
                    {
                        order: '1',
                        charge_number: '20230202123',
                        user_id: '姜子鱼',
                        phone:'159****3765',
                        charging_money:45,
                        account_money:50,
                        state:1,
                        charge_time:'2023.03.03',
                        id:2
                    },
                    {
                        order: '1',
                        charge_number: '20230202123',
                        user_id: '姜子鱼',
                        phone:'159****3765',
                        charging_money:45,
                        account_money:20,
                        state:1,
                        charge_time:'2023.03.03',
                        id:3
                    },
                ],
                newDetailVisible:false,
                chargeDetail:{}, //充值详情
                is_detail:false,
            }
        },
        methods: {
            
            goDetail(id){
                this.newDetailVisible = true
            },

        
        },
        
    }
</script>

<style lang="less" scoped>
.searchInput{
    text-align: left;
    font-size: 14px;
    height: 50px;
    font-family: PingFang SC-Regular, PingFang SC;
    font-weight: 400;
    color: #666666 !important;
}
.el-input{
    width: 280px;
    height: 35.98px;
    font-size: 11.97px;
    color: #666666;
    background: #F0F1F6;
}
.el-input__inner{
  background-color: #F0F1F6;  
}
.el-select{
    width: 280px;
    height: 35.98px;
}
.kuang{
    float: left;
    height: 50px;
}
.btns{
    float: right;
}
.el-button{
    background: transparent;
    border: none;
}
.chaxun{
    background: #165BFF;
    color: white;
}
.reset{
    background: #F0F1F6;
    color: #666666;
}
.addBtn{
    text-align: left;
    margin-top: 32px;
}
.newAdd{
    background: #165BFF;
    color: white;
    width: 92px;
    height: 36px;
}
::v-deep .el-table th > .cell {
  text-align: center;
}

::v-deep .el-table .cell {
  text-align: center;
}
.editBtn{
    display: inline-block;
    margin-right: 8px;
    color: #09D796;
    cursor: pointer;
}
.detailBtn{
    margin-right: 8px;
    display: inline-block;
    color: #165BFF;
    cursor: pointer;
}
.deleteBtn{
    display: inline-block;
    color: #FA698D;
    cursor: pointer;
}
.confirmButtonClass{
    background: #165bff;
}
#dialog .el-dialog__header {
    padding: 20px 20px 0px;
    background: #165BFF;
    text-align: left;
    font-weight: bold;
}
#dialog .el-dialog__body{
    height: 188px;
}
.formCancel,.formConfirm{
    width: 140px;
    height: 44px;
    border-radius: 4px 4px 4px 4px;
    border: none;
    opacity: 1;
}
.formCancel{
    background: white;
    border: 1px solid #F0F1F6;
}
.formConfirm{
    margin-left: 24px;
    background: #165BFF;
}
.dialog-footer{
    margin-top: -32px;
    text-align: center;
}
.el-dialog .el-input{
    width: 423px;
}
.el-dialog .el-select{
    width: 423px;
}
.dialog_title{
    margin-top: 24px;
    font-size: 16px;
    font-family: PingFang SC-Medium, PingFang SC;
    font-weight: 500;
    color: #000000;
}
.kuang>div{
    margin: 5px auto;
    display: inline-block;
}
.el-table{
    margin-top: 32px;
}
</style>